package hongcheng.code_generator.entity.config;

import hongcheng.code_generator.exception.CustomException;

/**
 * 	注释生成配置
 * */
public class CommentConfig {

	/**
	 * 	是否添加功能说明注释，默认为true
	 * */
	private boolean isAddFunctionComment = true;
	/**
	 * 	是否添加作者注释，默认为true
	 * */
	private boolean isAddAuthorComment = true;
	/**
	 * 	是否添加参数说明注释，默认为true
	 * */
	private boolean isAddParamComment = true;
	/**
	 * 	是否添加返回值注释，默认为true
	 * */
	private boolean isAddReturnComment = true;
	/**
	 * 	是否添加生成日期注释，默认为true
	 * */
	private boolean isAddDateComment = true;
	
	/**
	 * 	作者信息
	 * */
	private String author = "";
	/**
	 * 	日期格式化串
	 * */
	private String dateCommentFormatPattern = "yyyy-MM-dd HH:mm:ss";
	
	/**
	 * 	内置日期格式化类型
	 * */
	public enum DateFormatType{
		DATE("Date","yyyy-MM-dd"),
		DATETIME("DataTime","yyyy-MM-dd HH:mm:ss"),
		TIME("Time","HH:mm:ss");
		
		private String name;
		private String dateFormatPattern;
		
		private DateFormatType(String name,String dateFormatPattern) {
			this.dateFormatPattern = dateFormatPattern;
			this.name = name;
		}
		
		public static DateFormatType fromName(String name) {
			DateFormatType[] dateFormatTypes = DateFormatType.values();
			for(DateFormatType dateFormatType:dateFormatTypes) {
				if(dateFormatType.name.equals(name.trim())) {
					return dateFormatType;
				}
			}
			throw new CustomException("找不到name为{}的枚举：" , name)  ;
		}

		public String getName() {
			return name;
		}

		public String getDateFormatPattern() {
			return dateFormatPattern;
		}
		
		
		
	}
	
	public String getDateCommentFormatPattern() {
		return dateCommentFormatPattern;
	}
	public void setDateCommentFormatPattern(String dateCommentFormatPattern) {
		this.dateCommentFormatPattern = dateCommentFormatPattern;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
	/**
	 * @return the isAddFunctionComment
	 */
	public boolean getIsAddFunctionComment() {
		return isAddFunctionComment;
	}
	/**
	 * @return the isAddAuthorComment
	 */
	public boolean getIsAddAuthorComment() {
		return isAddAuthorComment;
	}
	/**
	 * @return the isAddParamComment
	 */
	public boolean getIsAddParamComment() {
		return isAddParamComment;
	}
	/**
	 * @return the isAddReturnComment
	 */
	public boolean getIsAddReturnComment() {
		return isAddReturnComment;
	}
	/**
	 * @return the isAddDateComment
	 */
	public boolean getIsAddDateComment() {
		return isAddDateComment;
	}
	/**
	 * @param isAddFunctionComment the isAddFunctionComment to set
	 */
	public void setIsAddFunctionComment(boolean isAddFunctionComment) {
		this.isAddFunctionComment = isAddFunctionComment;
	}
	/**
	 * @param isAddAuthorComment the isAddAuthorComment to set
	 */
	public void setIsAddAuthorComment(boolean isAddAuthorComment) {
		this.isAddAuthorComment = isAddAuthorComment;
	}
	/**
	 * @param isAddParamComment the isAddParamComment to set
	 */
	public void setIsAddParamComment(boolean isAddParamComment) {
		this.isAddParamComment = isAddParamComment;
	}
	/**
	 * @param isAddReturnComment the isAddReturnComment to set
	 */
	public void setIsAddReturnComment(boolean isAddReturnComment) {
		this.isAddReturnComment = isAddReturnComment;
	}
	/**
	 * @param isAddDateComment the isAddDateComment to set
	 */
	public void setIsAddDateComment(boolean isAddDateComment) {
		this.isAddDateComment = isAddDateComment;
	}
	
	
	
	
	
}
